package com.mall.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.entity.Carousel;
import com.mall.mapper.CarouselMapper;
import com.mall.service.ICarouselService;
import org.springframework.stereotype.Service;

/**
 * @author ShouPeng
 * @since 2024-01-14
 * 轮播图服务实现类
 */
@Service
public class CarouselServiceImpl implements ICarouselService {
    final
    CarouselMapper carouselMapper;

    public CarouselServiceImpl(CarouselMapper carouselMapper) {
        this.carouselMapper = carouselMapper;
    }

    /**
     * 查询轮播图
     * @param page 页
     * @return list
     */
    @Override
    public IPage<Carousel> queryCarousel(Page<Carousel> page) {
        return carouselMapper.selectPage(page,new QueryWrapper<Carousel>().eq("is_delete",0).orderByDesc("carousel_sort"));
    }

}
